/**
 * Copyright (C) 2010 David Simonek <dafesimonek@gmail.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MaterialsActionsPanel.java
 *
 * Created on Jul 30, 2010, 2:44:57 PM
 */

package org.dafe.partyband.gui.songs;

import java.awt.Dimension;
import javax.swing.Action;
import org.dafe.partyband.gui.exports.ExportWizardAction;
import org.dafe.partyband.gui.songs.SongsTable.SongsModel;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;

/**
 *
 * @author dafe
 */
public class SongsActionsPanel extends javax.swing.JPanel {

    private final ExportWizardAction exportAction;
    private final Action openTextAction;
    private final Action playMp3Action;
    private final Action deleteAction;
    private final Action mergeAction;

    // TODO
    /*    private final Action printAction;*/

    /** Creates new form MaterialsActionsPanel */
    public SongsActionsPanel(Lookup selSongsLkp, Lookup materialsLkp, SongsModel songsModel, ViewConfigurationPanel viewConfig) {
        initComponents();

        openTextAction = ActionsFactory.createOpenTextSongAction(selSongsLkp);
        songsPane.add(openTextAction);
        playMp3Action = ActionsFactory.createPlayMp3SongAction(selSongsLkp);
        songsPane.add(playMp3Action);
        exportAction = new ExportWizardAction(NbBundle.getMessage(SongsTable.class, "ACT_ExportSongs"), materialsLkp);
        songsPane.add(exportAction);
        deleteAction = ActionsFactory.createDeleteSongsAction(selSongsLkp, songsModel);
        songsPane.add(deleteAction);

        mergeAction = ActionsFactory.createMergeSongsAction(selSongsLkp, songsModel);
        repairPane.add(mergeAction);

        configureViewPane.add(viewConfig);

        scrollPane.setViewportBorder(null);
    }

    @Override
    public Dimension getPreferredSize() {
        return new Dimension(super.getPreferredSize().width, 20);
    }

    public Action getMergeAction() {
        return mergeAction;
    }

    public ExportWizardAction getExportAction() {
        return exportAction;
    }

    public Action getDeleteAction() {
        return deleteAction;
    }

    public Action getOpenTextAction() {
        return openTextAction;
    }

    public Action getPlayMp3Action () {
        return playMp3Action;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        scrollPane = new javax.swing.JScrollPane();
        taskContainer = new org.jdesktop.swingx.JXTaskPaneContainer();
        songsPane = new org.jdesktop.swingx.JXTaskPane();
        repairPane = new org.jdesktop.swingx.JXTaskPane();
        configureViewPane = new org.jdesktop.swingx.JXTaskPane();

        setMinimumSize(new java.awt.Dimension(0, 0));

        scrollPane.setMinimumSize(new java.awt.Dimension(0, 0));

        songsPane.setToolTipText(org.openide.util.NbBundle.getMessage(SongsActionsPanel.class, "SongsActionsPanel.songsPane.toolTipText", new Object[] {})); // NOI18N
        songsPane.setTitle(org.openide.util.NbBundle.getMessage(SongsActionsPanel.class, "SongsActionsPanel.songsPane.title", new Object[] {})); // NOI18N
        taskContainer.add(songsPane);

        repairPane.setToolTipText(org.openide.util.NbBundle.getMessage(SongsActionsPanel.class, "SongsActionsPanel.repairPane.toolTipText", new Object[] {})); // NOI18N
        repairPane.setTitle(org.openide.util.NbBundle.getMessage(SongsActionsPanel.class, "SongsActionsPanel.repairPane.title", new Object[] {})); // NOI18N
        taskContainer.add(repairPane);

        configureViewPane.setTitle(org.openide.util.NbBundle.getMessage(SongsActionsPanel.class, "SongsActionsPanel.configureViewPane.title",new Object[] {})); // NOI18N
        taskContainer.add(configureViewPane);

        scrollPane.setViewportView(taskContainer);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(scrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 255, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(scrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private org.jdesktop.swingx.JXTaskPane configureViewPane;
    private org.jdesktop.swingx.JXTaskPane repairPane;
    private javax.swing.JScrollPane scrollPane;
    private org.jdesktop.swingx.JXTaskPane songsPane;
    private org.jdesktop.swingx.JXTaskPaneContainer taskContainer;
    // End of variables declaration//GEN-END:variables

}
